package thread;

public class ThreadDemo {
    public static void main(String[] args) {
        Thread t1 = new MyThread();
        Thread t2 = new MyThread1();

        t1.start(); //start是开始执行
        t2.start();

    }
}

class MyThread extends Thread { //第一步继承Thread
    public void run() { //第二步重写run方法，run方法中是线程要执行的代码
        for (int i = 0; i < 100; i++) {
            System.out.println("你是谁啊？");
        }
    }
}

class MyThread1 extends Thread {
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("开门啊！我是查水表的");
        }
    }
}
